{% from "macros/widgets.html" import navitem %}

<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
  <div class="container">
    <a href="{{ url_for('views.static_html', route='/') }}" class="navbar-brand">
      {% if Configs.ctf_logo %}
      <img class="img-responsive ctf_logo" src="{{ url_for('views.files', path=Configs.ctf_logo) }}" height="25" alt="{{ Configs.ctf_name }}">
      {% else %}
      {{ Configs.ctf_name }}
      {% endif %}
    </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#base-navbars"
            aria-controls="base-navbars" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="base-navbars">
      <ul class="navbar-nav mr-auto">
        {{ navitem("道馆", url_for("pwncollege_dojos.listing"), "fa-torii-gate", img="/themes/dojo_theme/static/img/dojo/pokemon-gym.svg") }}
        {{ navitem("VS Code", url_for("pwncollege_workspace.view_workspace", service="vscode"), "fa-terminal", new=True) }}
        {{ navitem("桌面", url_for("pwncollege_workspace.view_workspace", service="desktop"), "fa-desktop", new=True) }}
        {{ navitem("聊天", "https://kook.top/soUkFL", "fa-comments", new=True) }}
        {{ navitem("帮助", url_for("pwncollege_sensai.view_sensai"), "fa-question", new=True) }}
      </ul>

      <hr class="d-sm-flex d-md-flex d-lg-none">

      <ul class="navbar-nav ml-md-auto d-block d-sm-flex d-md-flex">
        {% if authed() %}
        {% if is_admin() %}
        {{ navitem("管理面板", url_for("admin.view"), "fa-wrench") }}
        {% endif %}

        {{ navitem("简介", url_for("pwncollege_users.view_self"), "fa-user-circle") }}
        {{ navitem("设置", url_for("views.settings"), "fa-cogs") }}
        {{ navitem("注销", url_for("auth.logout"), "fa-sign-out-alt", shrink=True) }}

        {% else %}
        {% if registration_visible() %}
        {% endif %}

        {{ navitem("统一身份认证", url_for("pwncollege_sso.cas_login", next=request.full_path), "fa-sign-in-alt") }}
        {% endif %}

        <li class="nav-item">
          <a class="nav-link close-link" href="javascript:void()">
            <span class="d-block" data-toggle="tooltip" data-placement="bottom" title="Hide Navbar">
              <i class="fas caret-up d-none d-md-block d-lg-none"></i>
            </span>
            <span class="d-sm-block d-md-none d-lg-block text-nowrap">
              <i class="fas fa-caret-up pr-1"></i>
              <span class="d-lg-none">隐藏导航栏</span>
            </span>
          </a>
        </li>
      </ul>
    </div>
  </div>
</nav>

<div class="navbar-pulldown">
  <i class="fas fa-fw fa-caret-down" title="Show navigation bar"></i>
</div>
